%%%-------------------------------------------------------------------
%%% @author Rain
%%% @doc 接口日志输出
%%% @end
%%%-------------------------------------------------------------------
-module(game_util_log).
-author("Rain").

%% API
-export([log/3, set_log_mod/1]).

%% @doc 获取日志模块
get_log_mod() ->
    persistent_term:get({log_mod, game_util}).

%% @doc 设置日志模块
set_log_mod(Mod) ->
    persistent_term:put({log_mod, game_util}, Mod).

%% @doc 日志
log(LogType, Format, Args) ->
    try
        Mod = get_log_mod(),
        Mod:log(LogType, Format, Args),
        ok
    catch
        _:_:_ ->
            logger:log(LogType, Format, Args)
    end.